﻿//CreativeGraphics.as该类创意图形类库的总的外部调用类
//vesion 1.0
//author 夏天的树人
//
package org.summerTree.graphics
{
	import flash.geom.Point;
	import flash.display.Shape;
	public class CreativeGraphics extends Adapter 
	{
 
        public static const VESION:String="vesion 1.0";
		private var grap:IGraphics;
		public function CreativeGraphics()
		{

		}
		
		override public function clone():*
		{
			return new CreativeGraphics();
		}
				
	    //绘制箭头类
		public function drawtArrow(radius:Number,fillColor:uint=0xffffff,alpha:Number=1):Base
		{
			var arrow:Arrow=new Arrow();
			add(arrow);
			arrow.CreatArrow(radius,fillColor,alpha);
			//return arrow;
			return arrow;
		}
				
		//绘制正弦曲线
		public function drawSinLine(swing:Number,wavelengh:Number,X_length:Number,amount:int,position:Point):Base
		{
			var sin:SinLine=new SinLine();
			add(sin);
			sin.CreatSinLine(swing,wavelengh,X_length,amount,position.x,position.y);	
			return sin;
		}
		//绘制余弦曲线
		public function drawCosLine(swing:Number,wavelengh:Number,X_length:Number,amount:int,position:Point):Base
		{
			var cos:CosLine=new  CosLine();
			add(cos);
			cos.CreatCosLine(swing,wavelengh,X_length,amount,position.x,position.y);			
			return cos;
		}
		
		//绘制虚线
		/*startPoint 开始点坐标
		 *endPoint   结束点坐标
		 *length     
		 长度
		 *grap       间隔
		 */
		public function drawDottedLine(startPoint:Point,endPoint:Point,length:Number,grap:Number):Base
		{
			var dot:DottedLine=new DottedLine();
			add(dot);
			dot.CreatDottedLine(startPoint,endPoint,length,grap);
			return dot;			
		}
		
			
		//绘制多边形
		public function drawPolygon(radius:Number,n:int,fillColor:uint=0xffffff,alpha:Number=1):Base
		{
			var polygon:Polygon=new Polygon();
			add(polygon);
			polygon.CreatPolygon(radius,n,fillColor,alpha);
			return polygon;
			
		}
				
		//绘制螺旋线
		public function drawHelixLine(radius:Number,n:int,angleType:String="rad"):Base
		{
			var helix:HelixLine=new HelixLine();
			add(helix);
			helix.creatHelixLine(radius,n,angleType);
			return helix;
		}
		
		//绘制扇形
		public function drawSector(radius:Number,startAngle:Number,endAngle:Number,fillcolor:uint=0xffffff,alpha:Number=1):Base
		{			
			var sector:Sector=new Sector();
			add(sector);
			sector.CreatSector(radius,startAngle,endAngle,fillcolor,alpha);
			return sector;
		}
		
		//绘制星形线
		public function drawStarLine(radius:Number,fillColor:uint=0xffffff,alpha:Number=1):Base
		{
			var star:StarLine=new StarLine();
			add(star);
			star.CreatStarLine(radius,fillColor,alpha);			
			return star;
		}
		
		
		//绘制星形
		//参数第一个意思长轴，第二个短轴，n为边数
		public function drawStar(long_radius:Number,short_radius:Number,n:int=5,fillcolor:uint=0xffffff,alpha:Number=1):Base
		{			
			var star:Star=new Star();
			add(star);
			star.CreatStar(long_radius,short_radius,n,fillcolor,alpha);	
			return star;
		}
			
	    //绘制齿轮
	    public function drawGearWheel(long_radius:Number,short_radius:Number,n:int=5,fillcolor:uint=0xffffff,alpha:Number=1):Base
		{
			var gear:GearWheel=new GearWheel();
			add(gear);
			gear.CreatGearWheel(long_radius,short_radius,n,fillcolor,alpha);
			return gear;
		}
		
		//绘制圆环
		public function drawCirque(long_radius:Number,short_radius:Number,fillColor:uint=0xffffff,alpha:Number=1):Base
		{
			var cirque:Cirque=new Cirque();
			add(cirque);
			cirque.CreatCirque(long_radius,short_radius,fillColor,alpha);			
			return cirque;
		}
		
		
		//绘制菱形
		public function drawDiamond(radius:Number,fillColor:uint=0xffffff,alpha:Number=1):Base
		{
			var digmond:Diamond=new Diamond();
			add(digmond);
			digmond.CreatDiamond(radius,fillColor,alpha);	
			return digmond;
		}
		
		
		//创建2D的玫瑰线
		/*@ radius 半径
		 *@ num 花瓣数
		 *@ type 角度和弧度选择
		 *@ lens 角度
		 *@ count 360度值
		*/
		public function drawRose(radius:Number,num:Number,type:String="rad",lens:int=1,count:int=360):Base
		{
			var rose:Rose=new Rose();
			add(rose);
			rose.CreatRose(radius,num,type,lens,count);			
			return rose;
		}
		
		//创建简单的鱼
		public function drawSimpleFish(Fish_Width:Number,Fish_Height:Number,eyes_Width:Number=5,Fish_rear:Number=50,n:int=4):Base
		{
			
			var fish:SimpleFish=new SimpleFish();
			add(fish);
			fish.CreatSimpleFish(Fish_Width,Fish_Height,eyes_Width=5,Fish_rear,n);
			return fish;
		}
		
		//创建递归树
		//绘图对象，基本坐标px,py,角度，偏移长度，数量
		public function drawTree(px:Number,py:Number,angle:Number,len:Number,n:int,offerAngle:Number=30):Base
		{
			var tree:SimpleTree=new SimpleTree();
			add(tree);
			tree.CreatTree(px,py,angle,len,n,offerAngle);		
			return tree;
		}
		
		//绘制太极		
		public function drawTaiJi(radius:Number):Base
		{
			 var taiji:TaiJi=new TaiJi(radius);
			 add(taiji);
			 return taiji;
		}
		
		
		//绘制秀曲线图形
		//创建图案
		/* radius 半径
		 * angle_num:分多少份，以360度为计算
		 *segment_num 直线分成的段数单位数目
		 *
		 */
		public function drawBeautifulCurve(radius:Number,angle_num:int,segment_num:int):Base
		{
			var curve:BeautifulCurve=new BeautifulCurve();
			add(curve);
			curve.CreatBeautifulCurve(radius,angle_num,segment_num);		
			return curve;
		}
		
		//绘制弧线
		/*radius 半径
		 *start_Angle 开始角
		 *end_Angle  结束角 按数学逆时针计算
		*/
		public function drawArc(radius:Number,start_Angle:Number,end_Angle:Number):Base
		{
			var arc:Arc=new Arc();
			add(arc);
			arc.CreatArc(radius,start_Angle,end_Angle);		
			return arc;	
		}
		
		//绘制太阳花
		/*
		 *
		 *
		 */
		public function drawSunFlower(radius:Number,n:Number=10,fillColor:Number=0xFFFF00,alpha:Number=1):Base
		{
			var flower:SunFlower=new SunFlower();
			add(flower);
			flower.CreatSunFlower(radius,n,fillColor,alpha);
			
			return flower;
			
		}
		
		
	}

}